#include "HomeScene.h"
#include "../GlobalLayer.h"
#include "../../../model/vo/DataVO.h"
#include "../../../model/proxy/UserProxy.h"
#include "../../../model/proxy/ItemProxy.h"
#include "../../../net/NetController.h"
#include "../MainMenuLoader.h"
#include "../UserInfoLoader.h"
#include "../HomeSceneContentLoader.h"
#include "../TaskListLoader.h"
#include "../TaskDescLoader.h"
#include "HomeSceneLoader.h"
HomeScene::HomeScene()
:mScroll(NULL)
{
    
}

HomeScene::~HomeScene()
{
    CC_SAFE_RELEASE(mScroll);
}

bool HomeScene::init()
{
	State::init();
	return true;
}

void HomeScene::onEnter()
{
	State::onEnter();
	refresh();
	CCArray* nameList = CCArray::create(ccs(kNCRegist),NULL);
	RegisterObservers(this, nameList, callfuncO_selector(HomeScene::_onNotification));
}

void HomeScene::onExit()
{
	State::onExit();
}

void HomeScene::refresh()
{
}

void HomeScene::_onNotification(CCObject* object)
{
    CCLog("HomeScene::_onNotification");

	NotificationObserver* notification = (NotificationObserver*)object;
	const char* name = notification->getName();
	if (name == kNCGameInit)
	{
	} 
	else if(name == kNCGameLoad)
	{
		
	}
}

bool HomeScene::onAssignCCBMemberVariable( cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode )
{
    CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mScorll", CCScrollView*, mScroll);
	return true;
}

void HomeScene::onNodeLoaded( CCNode * pNode, CCNodeLoader * pNodeLoader )
{
    CCPoint point = ccp(0, -180);
    mScroll->setContentOffset(point);
}



